package com.huike.clues.service.impl;


import com.huike.clues.domain.vo.ClueTrackRecordVo;
import com.huike.clues.domain.vo.TrackRecordVo;
import com.huike.clues.mapper.TbClueMapper;
import com.huike.clues.mapper.TbClueTrackRecordMapper;
import com.huike.clues.service.ITbClueTrackRecordService;
import com.huike.common.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 线索跟进记录Service业务层处理
 * @date 2022-04-22
 */
@Service
@Slf4j
public class TbClueTrackRecordServiceImpl implements ITbClueTrackRecordService {
    @Autowired
    private TbClueTrackRecordMapper tbClueTrackRecordMapper;
    @Autowired
    private TbClueMapper clueMapper;

    @Transactional
    @Override
    public void add(ClueTrackRecordVo clueTrackRecordVo) {
        //获取登陆人
        String username = SecurityUtils.getUsername();

        //新增线索
        clueMapper.add(clueTrackRecordVo ,  username);


        //新增跟进记录
        tbClueTrackRecordMapper.add(clueTrackRecordVo ,  username);
    }

    @Override
    public List<TrackRecordVo> list(Long clueId) {
        return tbClueTrackRecordMapper.list(clueId);
    }
}
